{extend name='common@layout/seller' /}
{block name="left"}{include file='goods/left'}{/block}
{block name="breadcrumb"}
<div class="ncsc-path"><i class="icon-desktop"></i>商家管理中心<i class="icon-angle-right"></i>商品<i class="icon-angle-right"></i>商品图片管理</div>
{/block}
{block name='content'}
{if $type eq 'goods_add'}
{include file='goods/step'}
{else /}
<div class="tabmenu">
    <ul class="tab pngFix">
        <li class="normal"><a  href="{:url('seller/goods/modify?commonid='.input('id/d'))}">编辑商品</a></li>
        <li class="active"><a>编辑图片</a></li>
    </ul>
</div>
{/if}
<form method="post" id="goods_image" action="/?s=seller/goods/images_save">
    <input type="hidden" name="commonid" value="{:input('id/d')}">
    <input type="hidden" name="type" value="{$type}">
    <div class="ncsc-form-goods-pic">
        <div class="container">
            {foreach $goods_images as $sp_value_id=>$one}
            <div class="ncsc-goodspic-list">
                {neq name='sp_value_id' value='0'}
                <div class="title">
                    <h3>服务地区：{$color[$sp_value_id]}</h3>
                </div>
                {/neq}
                <ul nctype="ul{$sp_value_id}">
                    {foreach $one as $k=>$two}
                    <li class="ncsc-goodspic-upload">
                        <div class="upload-thumb"><img alt="商品图" src="{$two.thumb ?? '/old/data/upload/shop/common/default_goods_image_240.gif'}" nctype="file_{$sp_value_id}{$k}">
                            <input type="hidden" name="img[{$sp_value_id}][{$k}][name]" value="{$two.goods_image ?? ''}" nctype="file_{$sp_value_id}{$k}">
                        </div>
                        
                        <div class="show-default {eq name='two.is_default' value='1'}selected{/eq}" nctype="file_{$sp_value_id}{$k}">
                            <p>
                                <i class="icon-ok-circle"></i>默认主图
                                <input type="hidden" name="img[{$sp_value_id}][{$k}][default]" value="{$two.is_default ?? '0'}">
                            </p>
                            <a href="javascript:void(0)" nctype="del" class="del" title="移除">X</a>
                        </div>
                        <div class="show-sort">
                            排序：<input name="img[{$sp_value_id}][{$k}][sort]" type="text" class="text" value="{$two.goods_image_sort ?? '0'}" size="1" maxlength="1">
                        </div>
                        <div class="ncsc-upload-btn">
                            <a href="javascript:void(0);">
                                <span><input type="file" hidefocus="true" size="1" class="input-file" name="file_{$sp_value_id}{$k}" id="file_{$sp_value_id}{$k}"></span>
                                <p><i class="icon-upload-alt"></i>上传</p>
                            </a>
                        </div>
                    </li>
                    {/foreach}
                </ul>
                <div class="ncsc-select-album">
                    <a class="ncsc-btn" href="/?s=seller/album/pic_list&item=goods_image&inajax=1&color={$sp_value_id}" nctype="select-{$sp_value_id}"><i class="icon-picture"></i>从图片空间选择</a>
                    <a href="javascript:void(0);" nctype="close_album" class="ncsc-btn ml5" style="display: none;"><i class=" icon-circle-arrow-up"></i>关闭相册</a>
                </div>
                <div nctype="album-{$sp_value_id}"></div>
            </div>
            {/foreach}
        </div>
        <div class="sidebar">
            <div class="alert alert-info alert-block" id="uploadHelp">
                <div class="faq-img"></div>
                <h4>上传要求：</h4>
                <ul>
                    <li>1. 请使用jpg\jpeg\png等格式、单张大小不超过1M的正方形图片。</li>
                    <li>2. 上传图片最大尺寸将被保留为1280像素。</li>
                    <li>3. 每种服务地区最多可上传5张图片或从图片空间中选择已有的图片，上传后的图片也将被保存在店铺图片空间中以便其它使用。</li>
                    <li>4. 通过更改排序数字修改商品图片的排列显示顺序。</li>
                    <li>5. 图片质量要清晰，不能虚化，要保证亮度充足。</li>
                    <li>6. 操作完成后请点下一步，否则无法在网站生效。</li>
                </ul>
                <h4>建议:</h4>
                <ul>
                    <li>1. 主图为白色背景正面图。</li>
                    <li>2. 排序依次为正面图->背面图->侧面图->细节图。</li>
                </ul>
            </div>
        </div>
    </div>
    <div class="bottom tc hr32">
        <label class="submit-border"><input type="submit" class="submit" value="{if $type eq 'goods_add'}下一步，确认商品发布{else/}提交{/if}" /></label>
    </div>
</form>
<script type="text/javascript" src="/old/data/resource/js/fileupload/jquery.ui.widget.js?v1.2" charset="utf-8"></script>
<script type="text/javascript" src="/old/data/resource/js/fileupload/jquery.fileupload.js?v1.2" charset="utf-8"></script>
<script src="/old/data/resource/js/jquery.ajaxContent.pack.js?v1.2" type="text/javascript"></script>
<script type="text/javascript" src="/old/shop/resource/js/store_goods_add.step3.js?v1.2" charset="utf-8"></script>
<script>
    var DEFAULT_GOODS_IMAGE = "/old/data/upload/shop/common/default_goods_image_240.gif";
    $(function () {
        {if $type neq 'goods_add'}
        $('input[type="submit"]').click(function () {
            ajaxpost('goods_image', '', '', 'onerror');
        });
        {/if}
        {foreach $goods_images as $sp_value_id=>$one}
        $('a[nctype="select-{$sp_value_id}"]').ajaxContent({
            event: 'click',
            loaderType: "img",
            loadingMsg: SHOP_TEMPLATES_URL + "/images/loading.gif",
            target: 'div[nctype="album-{$sp_value_id}"]'
        }).click(function () {
            $(this).hide();
            $(this).next().show();
        });
        {/foreach}
    });
</script>
{/block}